from Buiness.Management import Management
from common.BasePage1 import BasePage1
class Member(BasePage1):
    def __init__(self,driver=None):
        super().__init__(driver)
        self.account_loc="id,account"
        self.realname_loc="id,realname"
        self.gender_loc = "id,genderm"
        self.role_loc = "id,role"
        self.password1_loc = "id,password1"
        self.password2_loc = "id,password2"
        self.email_loc = "id,email"
        self.submit_loc = "id,submit"
        self.assert_text_loc="xpath,/html/body/div/div/div[2]/div/div[2]/form/table/tbody/tr[1]/td/span"
        self.assert_text_loc1="xpath,/html/body/div/div/div/div[2]/div/div/table/tbody/tr/td[11]/a[1]"
    def enter_account(self,username):
        self.input(self.account_loc,username)
        self.wait(1)
    def enter_realname(self,name):
        self.input(self.realname_loc,name)
        self.wait(1)
    def enter_gender(self):
        self.click(self.gender_loc)
        self.wait(1)
    def enter_role(self,value):
        self.dropdown(self.role_loc,value)
    def enter_password1(self,mm):
        self.input(self.password1_loc,mm)
        self.wait(1)
    def enter_password2(self, MM):
        self.input(self.password2_loc, MM)
        self.wait(1)
    def enter_email_loc(self,num):
        self.input(self.email_loc, num)
        self.wait(1)
    def get_assert_text(self):
        return self.get_ele_text(self.assert_text_loc)
    def get_assert_text1(self):
        return self.get_ele_text(self.assert_text_loc1)
    def click_login_button(self):
        self.click(self.submit_loc)
        self.wait(2)
    def test_member(self,username="46465465465456",name="fefefefeffefefe",mm="123456",MM="123456",num="5964687984654@qq.com"):
        mg = Management(driver=self.driver)
        mg.test_management()
        self.enter_account(username)
        self.enter_realname(name)
        self.enter_gender()
        self.enter_role("dev")
        self.enter_password1(mm)
        self.enter_password2(MM)
        self.enter_email_loc(num)
        self.click_login_button()
if __name__ == '__main__':
    mb=Member()
    mb.test_member()